package com.wqc.service.impl;

import com.wqc.dao.DictionaryMapper;
import com.wqc.model.Dictionary;
import com.wqc.service.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictionaryServiceImpl implements DictionaryService {

    @Autowired
    private DictionaryMapper dictionaryMapper;

    //@Cacheable(value="test1",key= "'all'")
    @Cacheable(cacheNames="test1",key= "'all'")
    @Override
    public List<Dictionary> getAllDictionary() {
        return dictionaryMapper.selectForList();
    }

    @Cacheable(value="test2",key= "'all'")
    @Override
    public Dictionary getDictionaryByTypeAndKey(String typeAndKey) {
        return dictionaryMapper.selectByTypeAndKey(typeAndKey);
    }

}
